﻿using FastEndpoints;
using FluentValidation;

namespace TodoList.FastEndpoints.Features.Create;

internal sealed class Request
{
    public string Title { get; set; }= null!;
    public string Description { get; set; }= null!;
    public bool IsCompleted { get; set; }
    public DateTime DueDate { get; set; }

    internal sealed class Validator : Validator<Request>
    {
        public Validator()
        {
            RuleFor(r => r.Title)
                .NotEmpty()
                .WithMessage("Title is required.");
            RuleFor(r => r.Description)
                .NotEmpty()
                .WithMessage("Description is required.");
            RuleFor(r => r.DueDate)
                .GreaterThan(DateTime.Now)
                .WithMessage("DueDate must be in the future.");
        }
    }
}

internal sealed class Response
{
    public string? Message { get; set; }
}
